package org.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.example.common.Result;
import org.example.pojo.Collect;
import org.example.service.CollectService;
import org.example.mapper.CollectMapper;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.HashMap;
import java.util.List;

/**
* @author 13326
* @description 针对表【hards_collect】的数据库操作Service实现
* @createDate 2025-01-12 14:39:52
*/
@Service
public class CollectServiceImpl extends ServiceImpl<CollectMapper, Collect>
    implements CollectService{
    @Resource
    private CollectMapper collectMapper;
@Override
    public Result iscollect(Integer userId,Integer businessId){
    HashMap<String,Object> map=new HashMap<>();
    Collect collect=collectMapper.selectOneByID(userId,businessId);
    if(collect!=null){
        return Result.ok(true);
    }else{
        return Result.ok(false);
    }


}
@Override
    public Result add(@RequestBody Collect collect){
    collectMapper.insert(collect);
    return Result.ok(true);

}
@Override
    public Result shanchu(Integer userId, Integer businessId){
    collectMapper.delectcollect(userId,businessId);
    return Result.ok(true);
}
@Override
    public Result getall(Integer userId){

    List<Collect> list1=collectMapper.selectall(userId);
    return Result.ok(list1);

}
}




